import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router'

const routes: Array<RouteRecordRaw> = [
  {
    path: '/first',
    name: 'first',
    component: () => import('@/pages/firstTime.vue')
  },
  {
    path: '/login',
    name: 'Login',
    component: () => import('@/pages/login.vue')
  },
  {
    path: '/',
    name: 'Homepage',
    component: () => import('@/pages/homepage.vue')
  },
  {
    name: 'instance',
    path: '/instance',
    redirect: 'instance/instance',
    children: [
      {
        name: 'instanceList',
        path: '/instanceList',
        component: () => import('@/pages/instance/instance.vue')
      },
      {
        name: 'instanceDetails',
        path: 'instanceDetails/:id',
        component: () => import('@/pages/instance/instanceDetails.vue')
      }
    ]
  },
  {
    name: 'eventAudit',
    path: '/eventAudit',
    redirect: 'eventAudit/eventList',
    children: [
      {
        name: 'eventList',
        path: 'eventList',
        component: () => import('@/pages/eventAudit/eventList.vue'),
      },
      {
        name: 'messageList',
        path: 'messageList',
        component: () => import('@/pages/eventAudit/messageManage.vue')
      }
    ]
  },
  {
    path: '/fleet',
    name: 'fleet',
    redirect: 'fleet/runningState',
    children: [
      {
        name: 'createFleet',
        path: 'createFleet',
        component: () => import('@/pages/fleet/index.vue')
      },
      {
        name: 'fleetDetails',
        path: 'fleetDetails/:id/:name',
        component: () => import('@/pages/fleet/fleetDetails/index.vue')
      },
      {
        name: 'runningState',
        path: 'runningState',
        component: () => import('@/pages/runningState/index.vue')
      },
      {
        name: 'autoScaling',
        path: 'autoScaling',
        component: () => import('@/pages/autoScaling/index.vue')
      },
      {
        name: 'createAutoScaling',
        path: 'createAutoScaling',
        component: () => import('@/pages/autoScaling/create/index.vue')
      },
      {
        name: 'autoScalingDetails',
        path: 'autoScalingDetails/:id',
        component: () => import('@/pages/autoScaling/autoScallingDetails.vue')
      }
    ]
  },
  {
    path: '/application',
    name: 'application',
    redirect: 'application/applicationList',
    children: [
      {
        name: 'createApplication',
        path: 'createApplication',
        component: () => import('@/pages/application/applicationCreate.vue')
      },
      {
        name: 'applicationList',
        path: 'applicationList',
        component: () => import('@/pages/application/index.vue')
      },
      {
        name: 'applicationDetail',
        path: 'applicationDetail/:id',
        component: () => import('@/pages/application/applicationDetail.vue')
      }
    ]
  },
  {
    path: '/userInfo',
    name: 'userInfo',
    redirect: 'userInfo/userInfoList',
    children: [
      {
        name: 'userInfoList',
        path: 'userInfoList',
        component: () => import('@/pages/userInfo/index.vue')
      },
      {
        name: 'resconfigDetails',
        path: 'resconfigDetails/:Rdata',
        component: () => import('@/pages/userInfo/details.vue')
      },
    ]
  },
  {
    path: '/userMgmt',
    name: 'userMgmt',
    redirect: 'userMgmt/userMgmtList',
    children: [
      {
        name: 'adduser',
        path: 'adduser',
        component: () => import('@/pages/userMgmt/adduser.vue')
      },
      {
        name: 'userMgmtList',
        path: 'userMgmtList',
        component: () => import('@/pages/userMgmt/index.vue')
      },
      {
        name: 'insert',
        path: 'insert',
        component: () => import('@/pages/userMgmt/Insert.vue')
      },
      {
        name: 'insertResourceConfig',
        path: 'insertResourceConfig',
        component: () => import('@/pages/userMgmt/insertResourceConfig.vue')
      }
    ]
  },
  {
    path: '/aliases',
    name: 'aliases',
    redirect: 'aliases/aliasesList',
    children: [
      {
        name: 'createAlias',
        path: 'createAlias',
        component: () => import('@/pages/aliases/createAlias.vue')
      },
      {
        name: 'aliasesList',
        path: 'aliasesList',
        component: () => import('@/pages/aliases/index.vue')
      },
      {
        name: 'aliasDetail',
        path: 'aliasDetail/:id',
        component: () => import('@/pages/aliases/aliasDetail.vue')
      }
    ]
  },
  {
    path: '/lts',
    name: 'lts',
    redirect: 'lts/ltsList',
    children: [
      {
        name: 'createLts',
        path: 'createLts/:Tdata',
        component: () => import('@/pages/lts/createLts.vue')
      },
      {
        name: 'ltsList',
        path: 'ltsList',
        component: () => import('@/pages/lts/index.vue')
      },
      {
        name: 'ltsDetail',
        path: 'ltsDetail/:id',
        component: () => import('@/pages/lts/ltsDetail.vue')
      },
      {
        name: 'createTransfer',
        path: 'createTransfer/:idData',
        component: () => import('@/pages/lts/createTransfer.vue')
      }
    ]
  }
]

const router = createRouter({
  history: createWebHistory(),
  routes
})
export default router
